home *** CD-ROM | disk | FTP | other *** search
Wrap
package javax.crypto; import java.nio.ByteBuffer; import java.nio.ReadOnlyBufferException; import java.security.AlgorithmParameters; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.InvalidParameterException; import java.security.Key; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.Provider; import java.security.ProviderException; import java.security.PublicKey; import java.security.SecureRandom; import java.security.Security; import java.security.cert.Certificate; import java.security.cert.X509Certificate; import java.security.spec.AlgorithmParameterSpec; import java.security.spec.InvalidParameterSpecException; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.NoSuchElementException; import java.util.Set; import java.util.StringTokenizer; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.PBEParameterSpec; import javax.crypto.spec.RC2ParameterSpec; import javax.crypto.spec.RC5ParameterSpec; import sun.security.jca.GetInstance; import sun.security.jca.ServiceId; import sun.security.util.Debug; public class Cipher { // $FF: renamed from: a sun.security.util.Debug private static final Debug field_0 = Debug.getInstance("jca", "Cipher"); public static final int ENCRYPT_MODE = 1; public static final int DECRYPT_MODE = 2; public static final int WRAP_MODE = 3; public static final int UNWRAP_MODE = 4; public static final int PUBLIC_KEY = 1; public static final int PRIVATE_KEY = 2; public static final int SECRET_KEY = 3; // $FF: renamed from: b java.security.Provider private Provider field_1; // $FF: renamed from: c javax.crypto.CipherSpi private CipherSpi field_2; // $FF: renamed from: d java.lang.String private String field_3; // $FF: renamed from: e javax.crypto.SunJCE_f private SunJCE_f field_4; // $FF: renamed from: f javax.crypto.ExemptionMechanism private ExemptionMechanism field_5; // $FF: renamed from: g boolean private boolean field_6 = false; // $FF: renamed from: h int private int field_7 = 0; // $FF: renamed from: i java.lang.String private static final String field_8 = "2.5.29.15"; // $FF: renamed from: j javax.crypto.CipherSpi private CipherSpi field_9; // $FF: renamed from: k java.security.Provider.Service private Provider.Service field_10; // $FF: renamed from: l java.util.Iterator private Iterator field_11; // $FF: renamed from: m java.util.List private List field_12; // $FF: renamed from: n java.lang.Object private final Object field_13; // $FF: renamed from: o java.lang.String private static final String field_14 = "SupportedModes"; // $FF: renamed from: p java.lang.String private static final String field_15 = "SupportedPaddings"; // $FF: renamed from: q int private static final int field_16 = 0; // $FF: renamed from: r int private static final int field_17 = 1; // $FF: renamed from: s int private static final int field_18 = 2; // $FF: renamed from: t int private static int field_19 = 10; // $FF: renamed from: u int private static final int field_20 = 1; // $FF: renamed from: v int private static final int field_21 = 2; // $FF: renamed from: w int private static final int field_22 = 3; // $FF: renamed from: x int private static final int field_23 = 4; protected Cipher(CipherSpi var1, Provider var2, String var3) { if (!SunJCE_h.f.a()) { throw new NullPointerException(); } else { this.field_2 = var1; this.field_1 = var2; this.field_3 = var3; this.field_4 = SunJCE_k.b; this.field_13 = null; } } Cipher(CipherSpi var1, String var2) { this.field_2 = var1; this.field_3 = var2; this.field_4 = SunJCE_k.b; this.field_13 = null; } private Cipher(CipherSpi var1, Provider.Service var2, Iterator var3, String var4, List var5) { this.field_9 = var1; this.field_10 = var2; this.field_11 = var3; this.field_12 = var5; this.field_3 = var4; this.field_13 = new Object(); } // $FF: renamed from: a (java.lang.String) java.lang.String[] private static String[] method_0(String var0) throws NoSuchAlgorithmException { if (var0 == null) { throw new NoSuchAlgorithmException("No transformation given"); } else { String[] var1 = new String[3]; int var2 = 0; StringTokenizer var3 = new StringTokenizer(var0, "/"); try { while(var3.hasMoreTokens() && var2 < 3) { var1[var2++] = var3.nextToken().trim(); } if (var2 == 0 || var2 == 2 || var3.hasMoreTokens()) { throw new NoSuchAlgorithmException("Invalid transformation format:" + var0); } } catch (NoSuchElementException var5) { throw new NoSuchAlgorithmException("Invalid transformation format:" + var0); } if (var1[0] != null && var1[0].length() != 0) { return var1; } else { throw new NoSuchAlgorithmException("Invalid transformation:algorithm not specified-" + var0); } } } // $FF: renamed from: b (java.lang.String) java.util.List private static List method_1(String var0) throws NoSuchAlgorithmException { String[] var1 = method_0(var0); String var2 = var1[0]; String var3 = var1[1]; String var4 = var1[2]; if (var3 != null && var3.length() == 0) { var3 = null; } if (var4 != null && var4.length() == 0) { var4 = null; } if (var3 == null && var4 == null) { r var6 = new r(var2, "", (String)null, (String)null); return Collections.singletonList(var6); } else { ArrayList var5 = new ArrayList(4); var5.add(new r(var2, "/" + var3 + "/" + var4, (String)null, (String)null)); var5.add(new r(var2, "/" + var3, (String)null, var4)); var5.add(new r(var2, "//" + var4, var3, (String)null)); var5.add(new r(var2, "", var3, var4)); return var5; } } // $FF: renamed from: a (java.security.Provider.Service, java.util.List) javax.crypto.Cipher.r private static r method_2(Provider.Service var0, List var1) { String var2 = var0.getAlgorithm().toUpperCase(Locale.ENGLISH); for(r var4 : var1) { if (var2.endsWith(var4.b)) { return var4; } } return null; } public static final Cipher getInstance(String var0) throws NoSuchAlgorithmException, NoSuchPaddingException { List var1 = method_1(var0); ArrayList var2 = new ArrayList(var1.size()); for(r var4 : var1) { var2.add(new ServiceId("Cipher", var4.a)); } List var11 = GetInstance.getServices(var2); Iterator var12 = var11.iterator(); Exception var5 = null; while(var12.hasNext()) { Provider.Service var6 = (Provider.Service)var12.next(); if (SunJCE_b.b(var6.getProvider())) { r var7 = method_2(var6, var1); if (var7 != null) { int var8 = var7.a(var6); if (var8 != 0) { if (var8 == 2) { return new Cipher((CipherSpi)null, var6, var12, var0, var1); } try { CipherSpi var9 = (CipherSpi)var6.newInstance((Object)null); var7.a(var9); return new Cipher(var9, var6, var12, var0, var1); } catch (Exception var10) { var5 = var10; } } } } } throw new NoSuchAlgorithmException("Cannot find any provider supporting " + var0, var5); } public static final Cipher getInstance(String var0, String var1) throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException { if (var1 != null && var1.length() != 0) { Provider var2 = Security.getProvider(var1); if (var2 == null) { throw new NoSuchProviderException("No such provider: " + var1); } else { return getInstance(var0, var2); } } else { throw new IllegalArgumentException("Missing provider"); } } public static final Cipher getInstance(String var0, Provider var1) throws NoSuchAlgorithmException, NoSuchPaddingException { if (var1 == null) { throw new IllegalArgumentException("Missing provider"); } else { Exception var2 = null; List var3 = method_1(var0); boolean var4 = false; String var5 = null; for(r var7 : var3) { Provider.Service var8 = var1.getService("Cipher", var7.a); if (var8 != null) { if (!var4) { Exception var9 = SunJCE_b.a(var1); if (var9 != null) { String var13 = "JCE cannot authenticate the provider " + var1.getName(); throw new SecurityException(var13, var9); } var4 = true; } if (var7.b(var8) != 0) { if (var7.c(var8) != 0) { try { CipherSpi var12 = (CipherSpi)var8.newInstance((Object)null); var7.a(var12); Cipher var10 = new Cipher(var12, var0); var10.field_1 = var8.getProvider(); var10.method_3(); return var10; } catch (Exception var11) { var2 = var11; } } else { var5 = var7.d; } } } } if (var2 instanceof NoSuchPaddingException) { throw (NoSuchPaddingException)var2; } else if (var5 != null) { throw new NoSuchPaddingException("Padding not supported: " + var5); } else { throw new NoSuchAlgorithmException("No such algorithm: " + var0, var2); } } } // $FF: renamed from: b () void private void method_3() throws NoSuchAlgorithmException { if (!SunJCE_b.c()) { this.field_4 = SunJCE_k.b; this.field_5 = null; } else { this.field_4 = method_14(this.field_3); String var1 = this.field_4.b(); if (var1 != null) { this.field_5 = ExemptionMechanism.getInstance(var1); } } } // $FF: renamed from: a () void void method_4() { if (this.field_2 == null) { synchronized(this.field_13) { if (this.field_2 == null) { if (field_0 != null) { int var2 = --field_19; if (var2 >= 0) { field_0.println("Cipher.init() not first method called, disabling delayed provider selection"); if (var2 == 0) { field_0.println("Further warnings of this type will be suppressed"); } (new Exception("Call trace")).printStackTrace(); } } Exception var10 = null; while(this.field_10 != null || this.field_11.hasNext()) { Provider.Service var3; CipherSpi var4; if (this.field_10 != null) { var3 = this.field_10; var4 = this.field_9; this.field_10 = null; this.field_9 = null; } else { var3 = (Provider.Service)this.field_11.next(); var4 = null; } if (SunJCE_b.b(var3.getProvider())) { r var5 = method_2(var3, this.field_12); if (var5 != null && var5.a(var3) != 0) { try { if (var4 == null) { Object var6 = var3.newInstance((Object)null); if (!(var6 instanceof CipherSpi)) { continue; } var4 = (CipherSpi)var6; } var5.a(var4); this.method_3(); this.field_2 = var4; this.field_1 = var3.getProvider(); this.field_10 = null; this.field_11 = null; this.field_12 = null; return; } catch (Exception var8) { var10 = var8; } } } } ProviderException var11 = new ProviderException("Could not construct CipherSpi instance"); if (var10 != null) { var11.initCause(var10); } throw var11; } } } } // $FF: renamed from: a (javax.crypto.CipherSpi, int, int, java.security.Key, java.security.spec.AlgorithmParameterSpec, java.security.AlgorithmParameters, java.security.SecureRandom) void private void method_5(CipherSpi var1, int var2, int var3, Key var4, AlgorithmParameterSpec var5, AlgorithmParameters var6, SecureRandom var7) throws InvalidKeyException, InvalidAlgorithmParameterException { switch (var2) { case 1: this.method_7(var1, var4); var1.engineInit(var3, var4, var7); break; case 2: this.method_8(var1, var4, var5); var1.engineInit(var3, var4, var5, var7); break; case 3: this.method_9(var1, var4, var6); var1.engineInit(var3, var4, var6, var7); break; case 4: this.method_7(var1, var4); var1.engineInit(var3, var4, var7); break; default: throw new AssertionError("Internal Cipher error: " + var2); } } // $FF: renamed from: a (int, int, java.security.Key, java.security.spec.AlgorithmParameterSpec, java.security.AlgorithmParameters, java.security.SecureRandom) void private void method_6(int var1, int var2, Key var3, AlgorithmParameterSpec var4, AlgorithmParameters var5, SecureRandom var6) throws InvalidKeyException, InvalidAlgorithmParameterException { synchronized(this.field_13) { if (this.field_2 != null) { this.method_5(this.field_2, var1, var2, var3, var4, var5, var6); } else { Exception var8 = null; while(this.field_10 != null || this.field_11.hasNext()) { Provider.Service var9; CipherSpi var10; if (this.field_10 != null) { var9 = this.field_10; var10 = this.field_9; this.field_10 = null; this.field_9 = null; } else { var9 = (Provider.Service)this.field_11.next(); var10 = null; } if (var9.supportsParameter(var3) && SunJCE_b.b(var9.getProvider())) { r var11 = method_2(var9, this.field_12); if (var11 != null && var11.a(var9) != 0) { try { if (var10 == null) { var10 = (CipherSpi)var9.newInstance((Object)null); } var11.a(var10); this.method_3(); this.method_5(var10, var1, var2, var3, var4, var5, var6); this.field_1 = var9.getProvider(); this.field_2 = var10; this.field_10 = null; this.field_11 = null; this.field_12 = null; return; } catch (Exception var14) { if (var8 == null) { var8 = var14; } } } } } if (var8 instanceof InvalidKeyException) { throw (InvalidKeyException)var8; } else if (var8 instanceof InvalidAlgorithmParameterException) { throw (InvalidAlgorithmParameterException)var8; } else if (var8 instanceof RuntimeException) { throw (RuntimeException)var8; } else { String var16 = var3 != null ? var3.getClass().getName() : "(null)"; throw new InvalidKeyException("No installed provider supports this key: " + var16, var8); } } } } public final Provider getProvider() { this.method_4(); return this.field_1; } public final String getAlgorithm() { return this.field_3; } public final int getBlockSize() { this.method_4(); return this.field_2.engineGetBlockSize(); } public final int getOutputSize(int var1) { if (!this.field_6 && !(this instanceof NullCipher)) { throw new IllegalStateException("Cipher not initialized"); } else if (var1 < 0) { throw new IllegalArgumentException("Input size must be equal to or greater than zero"); } else { this.method_4(); return this.field_2.engineGetOutputSize(var1); } } public final byte[] getIV() { this.method_4(); return this.field_2.engineGetIV(); } public final AlgorithmParameters getParameters() { this.method_4(); return this.field_2.engineGetParameters(); } public final ExemptionMechanism getExemptionMechanism() { this.method_4(); return this.field_5; } // $FF: renamed from: a (javax.crypto.CipherSpi, java.security.Key) void private void method_7(CipherSpi var1, Key var2) throws InvalidKeyException { if (this.field_4 != SunJCE_k.b) { AlgorithmParameterSpec var3; try { var3 = this.method_13(var1.engineGetParameters()); } catch (InvalidParameterSpecException var5) { throw new InvalidKeyException("Unsupported default algorithm parameters"); } if (!this.method_10(var1, var2, var3)) { throw new InvalidKeyException("Illegal key size or default parameters"); } } } // $FF: renamed from: a (javax.crypto.CipherSpi, java.security.Key, java.security.spec.AlgorithmParameterSpec) void private void method_8(CipherSpi var1, Key var2, AlgorithmParameterSpec var3) throws InvalidKeyException, InvalidAlgorithmParameterException { if (this.field_4 != SunJCE_k.b) { if (!this.method_10(var1, var2, (AlgorithmParameterSpec)null)) { throw new InvalidKeyException("Illegal key size"); } else if (var3 != null && !this.method_10(var1, var2, var3)) { throw new InvalidAlgorithmParameterException("Illegal parameters"); } } } // $FF: renamed from: a (javax.crypto.CipherSpi, java.security.Key, java.security.AlgorithmParameters) void private void method_9(CipherSpi var1, Key var2, AlgorithmParameters var3) throws InvalidKeyException, InvalidAlgorithmParameterException { if (this.field_4 != SunJCE_k.b) { AlgorithmParameterSpec var4; try { var4 = this.method_13(var3); } catch (InvalidParameterSpecException var6) { throw new InvalidAlgorithmParameterException("Failed to retrieve algorithm parameter specification"); } this.method_8(var1, var2, var4); } } // $FF: renamed from: b (javax.crypto.CipherSpi, java.security.Key, java.security.spec.AlgorithmParameterSpec) boolean private boolean method_10(CipherSpi var1, Key var2, AlgorithmParameterSpec var3) throws InvalidKeyException { String var4 = this.field_4.b(); int var5 = var1.engineGetKeySize(var2); int var7 = this.field_3.indexOf(47); String var6; if (var7 != -1) { var6 = this.field_3.substring(0, var7); } else { var6 = this.field_3; } SunJCE_f var8 = new SunJCE_f(var6, var5, var3, var4); if (!this.field_4.implies(var8)) { if (field_0 != null) { field_0.println("Crypto Permission check failed"); field_0.println("granted: " + this.field_4); field_0.println("requesting: " + var8); } return false; } else if (this.field_5 == null) { return true; } else { try { if (!this.field_5.isCryptoAllowed(var2)) { if (field_0 != null) { field_0.println(this.field_5.getName() + " isn't enforced"); } return false; } else { return true; } } catch (ExemptionMechanismException var10) { if (field_0 != null) { field_0.println("Cannot determine whether " + this.field_5.getName() + " has been enforced"); ((Throwable)var10).printStackTrace(); } return false; } } } // $FF: renamed from: a (int) void private static void method_11(int var0) { if (var0 < 1 || var0 > 4) { throw new InvalidParameterException("Invalid operation mode"); } } public final void init(int var1, Key var2) throws InvalidKeyException { this.init(var1, var2, SunJCE_b.b); } public final void init(int var1, Key var2, SecureRandom var3) throws InvalidKeyException { this.field_6 = false; method_11(var1); if (this.field_2 != null) { this.method_7(this.field_2, var2); this.field_2.engineInit(var1, var2, var3); } else { try { this.method_6(1, var1, var2, (AlgorithmParameterSpec)null, (AlgorithmParameters)null, var3); } catch (InvalidAlgorithmParameterException var5) { throw new InvalidKeyException(var5); } } this.field_6 = true; this.field_7 = var1; } public final void init(int var1, Key var2, AlgorithmParameterSpec var3) throws InvalidKeyException, InvalidAlgorithmParameterException { this.init(var1, var2, var3, SunJCE_b.b); } public final void init(int var1, Key var2, AlgorithmParameterSpec var3, SecureRandom var4) throws InvalidKeyException, InvalidAlgorithmParameterException { this.field_6 = false; method_11(var1); if (this.field_2 != null) { this.method_8(this.field_2, var2, var3); this.field_2.engineInit(var1, var2, var3, var4); } else { this.method_6(2, var1, var2, var3, (AlgorithmParameters)null, var4); } this.field_6 = true; this.field_7 = var1; } public final void init(int var1, Key var2, AlgorithmParameters var3) throws InvalidKeyException, InvalidAlgorithmParameterException { this.init(var1, var2, var3, SunJCE_b.b); } public final void init(int var1, Key var2, AlgorithmParameters var3, SecureRandom var4) throws InvalidKeyException, InvalidAlgorithmParameterException { this.field_6 = false; method_11(var1); if (this.field_2 != null) { this.method_9(this.field_2, var2, var3); this.field_2.engineInit(var1, var2, var3, var4); } else { this.method_6(3, var1, var2, (AlgorithmParameterSpec)null, var3, var4); } this.field_6 = true; this.field_7 = var1; } public final void init(int var1, Certificate var2) throws InvalidKeyException { this.init(var1, var2, SunJCE_b.b); } public final void init(int var1, Certificate var2, SecureRandom var3) throws InvalidKeyException { this.field_6 = false; method_11(var1); if (var2 instanceof X509Certificate) { X509Certificate var4 = (X509Certificate)var2; Set var5 = var4.getCriticalExtensionOIDs(); if (var5 != null && !var5.isEmpty() && var5.contains("2.5.29.15")) { boolean[] var6 = var4.getKeyUsage(); if (var6 != null && (var1 == 1 && var6.length > 3 && !var6[3] || var1 == 3 && var6.length > 2 && !var6[2])) { throw new InvalidKeyException("Wrong key usage"); } } } PublicKey var8 = var2 == null ? null : var2.getPublicKey(); if (this.field_2 != null) { this.method_7(this.field_2, var8); this.field_2.engineInit(var1, var8, var3); } else { try { this.method_6(4, var1, var8, (AlgorithmParameterSpec)null, (AlgorithmParameters)null, var3); } catch (InvalidAlgorithmParameterException var7) { throw new InvalidKeyException(var7); } } this.field_6 = true; this.field_7 = var1; } // $FF: renamed from: c () void private void method_12() { if (!(this instanceof NullCipher)) { if (!this.field_6) { throw new IllegalStateException("Cipher not initialized"); } if (this.field_7 != 1 && this.field_7 != 2) { throw new IllegalStateException("Cipher not initialized for encryption/decryption"); } } } public final byte[] update(byte[] var1) { this.method_12(); if (var1 == null) { throw new IllegalArgumentException("Null input buffer"); } else { this.method_4(); return var1.length == 0 ? null : this.field_2.engineUpdate(var1, 0, var1.length); } } public final byte[] update(byte[] var1, int var2, int var3) { this.method_12(); if (var1 != null && var2 >= 0 && var3 <= var1.length - var2 && var3 >= 0) { this.method_4(); return var3 == 0 ? null : this.field_2.engineUpdate(var1, var2, var3); } else { throw new IllegalArgumentException("Bad arguments"); } } public final int update(byte[] var1, int var2, int var3, byte[] var4) throws ShortBufferException { this.method_12(); if (var1 != null && var2 >= 0 && var3 <= var1.length - var2 && var3 >= 0) { this.method_4(); return var3 == 0 ? 0 : this.field_2.engineUpdate(var1, var2, var3, var4, 0); } else { throw new IllegalArgumentException("Bad arguments"); } } public final int update(byte[] var1, int var2, int var3, byte[] var4, int var5) throws ShortBufferException { this.method_12(); if (var1 != null && var2 >= 0 && var3 <= var1.length - var2 && var3 >= 0 && var5 >= 0) { this.method_4(); return var3 == 0 ? 0 : this.field_2.engineUpdate(var1, var2, var3, var4, var5); } else { throw new IllegalArgumentException("Bad arguments"); } } public final int update(ByteBuffer var1, ByteBuffer var2) throws ShortBufferException { this.method_12(); if (var1 != null && var2 != null) { if (var1 == var2) { throw new IllegalArgumentException("Input and output buffers must not be the same object, consider using buffer.duplicate()"); } else if (var2.isReadOnly()) { throw new ReadOnlyBufferException(); } else { this.method_4(); return this.field_2.engineUpdate(var1, var2); } } else { throw new IllegalArgumentException("Buffers must not be null"); } } public final byte[] doFinal() throws IllegalBlockSizeException, BadPaddingException { this.method_12(); this.method_4(); return this.field_2.engineDoFinal((byte[])null, 0, 0); } public final int doFinal(byte[] var1, int var2) throws IllegalBlockSizeException, ShortBufferException, BadPaddingException { this.method_12(); if (var1 != null && var2 >= 0) { this.method_4(); return this.field_2.engineDoFinal((byte[])null, 0, 0, var1, var2); } else { throw new IllegalArgumentException("Bad arguments"); } } public final byte[] doFinal(byte[] var1) throws IllegalBlockSizeException, BadPaddingException { this.method_12(); if (var1 == null) { throw new IllegalArgumentException("Null input buffer"); } else { this.method_4(); return this.field_2.engineDoFinal(var1, 0, var1.length); } } public final byte[] doFinal(byte[] var1, int var2, int var3) throws IllegalBlockSizeException, BadPaddingException { this.method_12(); if (var1 != null && var2 >= 0 && var3 <= var1.length - var2 && var3 >= 0) { this.method_4(); return this.field_2.engineDoFinal(var1, var2, var3); } else { throw new IllegalArgumentException("Bad arguments"); } } public final int doFinal(byte[] var1, int var2, int var3, byte[] var4) throws ShortBufferException, IllegalBlockSizeException, BadPaddingException { this.method_12(); if (var1 != null && var2 >= 0 && var3 <= var1.length - var2 && var3 >= 0) { this.method_4(); return this.field_2.engineDoFinal(var1, var2, var3, var4, 0); } else { throw new IllegalArgumentException("Bad arguments"); } } public final int doFinal(byte[] var1, int var2, int var3, byte[] var4, int var5) throws ShortBufferException, IllegalBlockSizeException, BadPaddingException { this.method_12(); if (var1 != null && var2 >= 0 && var3 <= var1.length - var2 && var3 >= 0 && var5 >= 0) { this.method_4(); return this.field_2.engineDoFinal(var1, var2, var3, var4, var5); } else { throw new IllegalArgumentException("Bad arguments"); } } public final int doFinal(ByteBuffer var1, ByteBuffer var2) throws ShortBufferException, IllegalBlockSizeException, BadPaddingException { this.method_12(); if (var1 != null && var2 != null) { if (var1 == var2) { throw new IllegalArgumentException("Input and output buffers must not be the same object, consider using buffer.duplicate()"); } else if (var2.isReadOnly()) { throw new ReadOnlyBufferException(); } else { this.method_4(); return this.field_2.engineDoFinal(var1, var2); } } else { throw new IllegalArgumentException("Buffers must not be null"); } } public final byte[] wrap(Key var1) throws IllegalBlockSizeException, InvalidKeyException { if (!(this instanceof NullCipher)) { if (!this.field_6) { throw new IllegalStateException("Cipher not initialized"); } if (this.field_7 != 3) { throw new IllegalStateException("Cipher not initialized for wrapping keys"); } } this.method_4(); return this.field_2.engineWrap(var1); } public final Key unwrap(byte[] var1, String var2, int var3) throws InvalidKeyException, NoSuchAlgorithmException { if (!(this instanceof NullCipher)) { if (!this.field_6) { throw new IllegalStateException("Cipher not initialized"); } if (this.field_7 != 4) { throw new IllegalStateException("Cipher not initialized for unwrapping keys"); } } if (var3 != 3 && var3 != 2 && var3 != 1) { throw new InvalidParameterException("Invalid key type"); } else { this.method_4(); return this.field_2.engineUnwrap(var1, var2, var3); } } // $FF: renamed from: a (java.security.AlgorithmParameters) java.security.spec.AlgorithmParameterSpec private AlgorithmParameterSpec method_13(AlgorithmParameters var1) throws InvalidParameterSpecException { if (var1 == null) { return null; } else { String var2 = var1.getAlgorithm().toUpperCase(Locale.ENGLISH); if (var2.equalsIgnoreCase("RC2")) { return var1.getParameterSpec(RC2ParameterSpec.class); } else if (var2.equalsIgnoreCase("RC5")) { return var1.getParameterSpec(RC5ParameterSpec.class); } else if (var2.startsWith("PBE")) { return var1.getParameterSpec(PBEParameterSpec.class); } else { return var2.startsWith("DES") ? var1.getParameterSpec(IvParameterSpec.class) : null; } } } // $FF: renamed from: c (java.lang.String) javax.crypto.SunJCE_f private static SunJCE_f method_14(String var0) throws NullPointerException, NoSuchAlgorithmException { if (var0 == null) { throw new NullPointerException(); } else { String[] var1 = method_0(var0); return SunJCE_h.f.a(var1[0]); } } public static final int getMaxAllowedKeyLength(String var0) throws NoSuchAlgorithmException { SunJCE_f var1 = method_14(var0); return var1.c(); } public static final AlgorithmParameterSpec getMaxAllowedParameterSpec(String var0) throws NoSuchAlgorithmException { SunJCE_f var1 = method_14(var0); return var1.e(); } }